﻿#region using statements

using System;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using NGen;
using NGen.Managers.GUI;

using Nuclex.UserInterface;

#endregion

namespace Psych.GUILayouts
{
    public class GUIElementHelpWindow : GUIElement
    {
        private readonly WindowWithOkButtonControl m_window = new WindowWithOkButtonControl();

        private Texture2D m_helpImage;

        protected override void _Cleanup() { }

        protected override void _Initialize()
        {
            m_helpImage = GameEngine.GameContent.Load<Texture2D>("Content\\Help");

            m_window.Bounds = new UniRectangle(new UniScalar(0.05f, 0), new UniScalar(0.0025f, 0.0f), m_helpImage.Width * 0.95f, m_helpImage.Height + 25);
            m_window.OkButton.Pressed += _OkButtonClick;
            m_window.OkButton.Bounds = new UniRectangle(new UniScalar(0.5f, -37.5f), new UniScalar(0.92f, 0.0f), new UniScalar(75.0f), new UniScalar(35.0f));
            m_window.Title = "How to Play";

            _Children.Add(m_window);
        }

        protected override void Update(GameTime p_gameTime) { }

        protected virtual void _OkButtonClick(object p_sender, EventArgs p_e)
        {
            GameEngine.GetService<IManagerGUI>().RemoveElement(this);
        }

        protected override void _Draw(GameTime p_gameTime)
        {
            GameEngine.SpriteBatch.Draw(m_helpImage, new Vector2(m_window.Bounds.Location.X.Offset + 60, m_window.Bounds.Location.Y.Offset + 30), null, Color.White, 0, new Vector2(), 0.9f, SpriteEffects.None, 1);
        }
    }
}